feat: add zemo ls to list topics#6
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add a
zemo lssubcommand that prints topic names from<memo>/topics/to stdout. The dump-style output (one per line, alphabetical, no.mdextension) is feed-back compatible withzemo <topic>and intended to integrate with terminal-side search (e.g. WezTerm QuickSearch) instead of an embedded picker.Related issue
Closes #3
Changes
Command.lsvariant incli.zig; routed fromparseArgsand dispatched inrun.doLs(env → path resolution) andlistTopics(path-based, testable) helpers.<memo>/topics/missing → exit 0 with no output (treated as empty memo).*.mdfiles only; subdirectories and other extensions are skipped; trailing.mdis stripped from each line.paths.memoDir: convert relativeZEMO_DIRto absolute viastd.process.currentPathAlloc. Pre-existing latent bug —Io.Dir.*Absolutecalls inopenScratch/openTopic/doSyncwouldasserton a relativeZEMO_DIR. Fixed centrally so all commands benefit.zemo lsto Features and Usage sections.zemo lsline.Testing
zig build testpasses locallyzig build run -- lsagainst~/memo)ZEMO_DIR(ZEMO_DIR=./relmemo zemo ls) — no panic, correct outputzig build -Dtarget=x86_64-windows/-Dtarget=x86_64-macosNew tests added:
parseArgs: ls subcommand— parser-levellistTopics: alphabetical order, only .md files— integration test usingstd.testing.tmpDirandIo.Writer.Allocatingto capture outputabsolutePath: keeps absolute paths/absolutePath: resolves relative paths from cwd— unit tests inpaths.zigfor the new normalization helperNotes for reviewers
listTopicswas extracted fromdoLsto keep the testable surface path-based (mirrors theresolveMemoDir/memoDirsplit inpaths.zig).paths.memoDirsignature gained anioparameter so it can read cwd; all existing call sites (openScratch/openTopic/doSync) updated accordingly.